package com.power.leopard.util;

import java.util.HashMap;
import java.util.Map;

public class ContextUtils {

	private static ThreadLocal<Map> localContext = new ThreadLocal<Map>();

	public static void putLocalContext(Object name, Object value) {
		Map<Object, Object> context = localContext.get();
		if (context == null) {
			localContext.set(context = new HashMap<Object, Object>());
		}
		context.put(name, value);
	}
	
	public static Object getLocalContext(Object key) {
		Map context = localContext.get();
		if (context == null) {
			return null;
		}
		return context.get(key);
	}

}
